/**************************************************
 * What is expected:
 *     A block of shared memory the processes related both have access to.
 *
 **************************************************/

#ifndef __ARCH_UM_DRIVERS_DEVICES_H__
#define __ARCH_UM_DRIVERS_DEVICES_H__

#include "console.h"  /* for CONSOLE_BUFFER_SIZE */
#include "clock.h"	  /* for ticks & TICK_NUM */

/**
 * Struct of the shared memory.
 * Including console at present.
 */
struct _device_common 
{
	/* pid of the child */
	int cpid;

	/* fid of virtual physical memory*/
	int vpm_fd;

	/* used by console as buffer */
	int cons_front;
	int cons_end;
	char cons_buffer[CONSOLE_BUFFER_SIZE];
};

extern struct _device_common *device_common;


void device_init_common (void);
void device_init_post (void);
void device_init_tracing_process (int cpid);
void device_init_child_process (void);
void device_dtor (void);

#endif  /* !__ARCH_UM_DRIVERS_DEVICES_H__ */
